Merged
Conversation
…loads - Added a new utility for detecting DRM protection in HLS manifests, preventing downloads of DRM-protected content. - Updated HlsDetectionHandler and HlsDownloadHandler to check for DRM in playlists and handle errors accordingly. - Enhanced UI to display warnings for DRM-protected content in the popup, disabling download options when necessary. - Refactored related functions to integrate DRM checks across video metadata extraction and download processes.
- Added `sanitizeFilename` utility to remove invalid characters from filenames in Direct, HLS, and M3U8 download handlers. - Updated download handlers to use sanitized filenames for improved file handling and to prevent errors during downloads. - Implemented fallback logic for empty or invalid base filenames, ensuring robust filename generation.
…S and M3U8 manifests - Updated HlsDownloadHandler and M3u8DownloadHandler to use `canDownloadHLSManifest` for validating if playlists can be downloaded, replacing the previous DRM checks. - Refactored `drm-utils` to separate DRM detection from download validation, enhancing clarity and maintainability of the code. - Improved error handling by throwing appropriate exceptions for unsupported encryption methods and DRM-protected content.
…nifests - Enhanced VideoMetadata interface to include `cannotDecrypt` property, indicating unsupported encryption methods. - Updated HlsDetectionHandler to set `cannotDecrypt` based on manifest analysis. - Introduced UI elements in the popup to display warnings for content that cannot be decrypted, improving user feedback. - Modified rendering logic in popup.ts to handle the new decryption status, disabling download options accordingly.
…loadHandler - Updated HlsDownloadHandler to fetch and validate master, video, and audio playlists more efficiently. - Removed redundant fetching of master playlist when quality preferences are provided, enhancing performance. - Improved handling of video and audio playlists by checking if they have already been fetched before making requests. - Enhanced code clarity by consolidating playlist validation logic, ensuring better maintainability.
…nsupported encryption detection - Updated VideoMetadata interface to replace `cannotDecrypt` with `unsupported` for better clarity on encryption status. - Modified HlsDetectionHandler to reflect the new property name when checking decryption capability. - Adjusted UI elements in popup.html and popup.ts to display warnings for unsupported encryption methods, improving user feedback. - Enhanced the canDecrypt function to better match unsupported encryption patterns, ensuring accurate detection.
- Updated popup.html and popup.ts to replace instances of "undecrypted" with "unsupported" for better clarity regarding encryption status. - Adjusted related UI elements and logic to ensure consistent messaging for unsupported encryption methods, enhancing user feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces robust DRM detection and handling for HLS and M3U8 downloads, along with improved filename sanitization throughout the downloader modules. It enhances user safety by preventing downloads of DRM-protected or undecryptable content, and ensures that filenames used in downloads are always valid and safe for the filesystem. Additionally, it improves error handling and user feedback in the UI regarding DRM and encryption issues.
DRM Detection and Enforcement:
drm-utils.tsto detect DRM in HLS manifests, check for supported encryption methods, and enforce download restrictions by throwing errors when DRM or unsupported encryption is detected. (src/core/utils/drm-utils.ts)src/core/detection/hls/hls-detection-handler.ts,src/core/downloader/hls/hls-download-handler.ts,src/core/downloader/m3u8/m3u8-download-handler.ts) [1] [2] [3] [4] [5] [6] [7] [8]Metadata and UI Feedback:
VideoMetadatainterface to includehasDrmandunsupportedfields, allowing the UI and logic to distinguish between DRM-protected and undecryptable content. (src/core/types.ts).status-drmand.status-undecryptedin the popup UI for clearer user feedback about DRM or unsupported encryption issues. (src/popup/popup.html) [1] [2]Filename Sanitization:
sanitizeFilenameutility to remove invisible and bidirectional Unicode characters, in addition to standard invalid characters. (src/core/utils/file-utils.ts)src/core/downloader/direct/direct-download-handler.ts,src/core/downloader/hls/hls-download-handler.ts,src/core/downloader/m3u8/m3u8-download-handler.ts) [1] [2] [3] [4] [5]Error Handling and Logging:
src/core/downloader/hls/hls-download-handler.ts)These changes collectively make the downloader safer, more robust, and user-friendly when dealing with protected or problematic content.